package agrep4me;

import java.util.Enumeration;
import java.util.Hashtable;

abstract class Table {
	// final static int NCHARS = 256;
	// protected States alpha[];
	private Hashtable alpha = new Hashtable();
	protected int fstate;
	protected States ex;

	public Table(States ex) {
		this.ex = ex;
	}

	abstract void match(Fichier f, int nerrs);

	protected States alphaGet(char c) {
		Character ch = new Character(c);
		Object ret = alpha.get(ch);
		if (ret == null) {
			States temp = ex.empty();
			alpha.put(ch, temp);
			return temp;
		} else {
			return (States) ret;
		}
	}

	protected void alphaPut(char c, States states) {
		alpha.put(new Character(c), states);
	}

	protected Enumeration alphaElements() {
		return alpha.elements();
	}
	
	protected int alphaSize(){
		return alpha.size();
	}
}
